#
# --- multi-stage Dockerfile
#
# Stage 1: build the binary
FROM golang:1.10.2-alpine

RUN apk add --no-cache --update alpine-sdk

COPY . /go/src/github.com/ingopansa/userinfoservice
RUN cd /go/src/github.com/ingopansa/userinfoservice && make release-binary

# Stage 2: build the actual Docker image
FROM alpine:3.6

RUN apk add --no-cache --update alpine-sdk && apk add curl

WORKDIR /srv
RUN adduser -D userinfoservice
USER userinfoservice
COPY --from=0 /go/bin/userinfoservice /srv

# Environment Variables
# "-dbaddr=postgresql://maxroach@cockroachdb-public.database.svc.cluster.local:26257/daivb_user_info?sslmode=disable"
# "-port=1234"
# "-jwtsigningkey=supersecret"
# "-jwtissuer=http://daivb-user-service-public.daivb-user-service.svc.cluster.local:1234"
ENTRYPOINT ["/srv/userinfoservice"]